package net.alteiar.ui.listener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;

import net.alteiar.ui.condition.MouseCondition;

public abstract class ConditionMouseAdapter extends MouseAdapter {

	private final MouseCondition condition;

	public ConditionMouseAdapter(MouseCondition condition) {
		this.condition = condition;
	}

	protected void realMouseClicked(MouseEvent e) {

	}

	protected void realMousePressed(MouseEvent e) {

	}

	protected void realMouseReleased(MouseEvent e) {

	}

	protected void realMouseEntered(MouseEvent e) {

	}

	protected void realMouseExited(MouseEvent e) {

	}

	protected void realMouseMoved(MouseEvent e) {

	}

	protected void realMouseDragged(MouseEvent e) {

	}

	protected void realMouseWheelMoved(MouseWheelEvent e) {

	}

	@Override
	public final void mouseClicked(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseClicked(e);
		}
	}

	@Override
	public final void mousePressed(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMousePressed(e);
		}
	}

	@Override
	public final void mouseReleased(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseReleased(e);
		}
	}

	@Override
	public final void mouseEntered(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseEntered(e);
		}
	}

	@Override
	public final void mouseExited(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseExited(e);
		}
	}

	@Override
	public final void mouseDragged(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseDragged(e);
		}
	}

	@Override
	public final void mouseMoved(MouseEvent e) {
		if (condition.canDoAction(e)) {
			realMouseMoved(e);
		}
	}

	@Override
	public final void mouseWheelMoved(MouseWheelEvent e) {
		if (condition.canDoAction(e)) {
			realMouseWheelMoved(e);
		}
	}
}
